package com.zpark.service.impl;

import com.zpark.dao.CourseDao;
import com.zpark.dao.impl.CourseDaoImpl;
import com.zpark.entity.Course;
import com.zpark.service.CourseService;

import java.util.List;

public class CourseServiceImpl implements CourseService {
    private CourseDao courseDao = new CourseDaoImpl();

    @Override
    public void add(Course course) {
        courseDao.insert(course);
    }

    @Override
    public void edit(Integer id, Course course) {
        courseDao.update(id,course);
    }

    @Override
    public void remove(Integer id) {
        courseDao.delete(id);
    }

    @Override
    public Course getOne(Integer id) {
        return courseDao.selectById(id);
    }

    @Override
    public List<Course> getPage(Integer size, Integer number) {
        int limitNumber =  (number - 1) * size;
        return courseDao.selectByPage(size,limitNumber);
    }
}
